Skip to content

Preserve Mount-managed DOM children when clearing or replacing UI children - #11444

Open
max-sixty wants to merge 1 commit into
Effect-TS:mainfrom
max-sixty:fix/ui-mount-remove-all
Open

max-sixty wants to merge 1 commit into
Effect-TS:mainfrom
max-sixty:fix/ui-mount-remove-all

Conversation

@max-sixty

Copy link
Copy Markdown
Contributor

Emptying or wholly replacing an element's rendered children calls host.clear(parent) (parent.textContent = ""). When that element carries a Mount that manages its own DOM children inside the host node (such as an adopted editor, chart, or imperative outlet), textContent = "" detaches the Mount's nodes even though only the rendered children were removed.

This change passes canClear = prev.mount === undefined && view.mount === undefined from patchElement into removeAll and patchList, falling back to individual unplace removals when the element carries a Mount while keeping bulk host.clear for elements without one.

Verified with pnpm test --run packages/effect/test/ui/html/BrowserHost.test.ts packages/effect/test/ui/html/BoundChildren.test.ts packages/effect/test/ui/Runtime.test.ts (320 passed; new BrowserHost test covers both emptying and full replacement and fails before the fix), pnpm lint-fix, and pnpm check.

This was written by Antigravity on behalf of max-sixty

@changeset-bot

changeset-bot Bot commented Dec 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f0f718f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 43 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/vitest Patch
@effect/ai-amazon-bedrock Patch
@effect/ai-anthropic Patch
@effect/ai-cloudflare Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/ai-typesafe Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/chat-discord Patch
@effect/chat-slack Patch
@effect/chat-teams Patch
@effect/chat-telegram Patch
@effect/chat-whatsapp Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-cloudflare Patch
@effect/platform-deno Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/doctest Patch
@effect/graphql-generator Patch
@effect/openapi-generator Patch
@effect/ui-devtools Patch
@effect/ui-native Patch
@effect/ui-opentui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-janitor effect-janitor Bot added the 4.0 label Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 40.45 KB 40.45 KB 0.00 KB (0.00%)
basic.ts 6.66 KB 6.66 KB 0.00 KB (0.00%)
batching.ts 11.90 KB 11.90 KB 0.00 KB (0.00%)
brand.ts 6.91 KB 6.91 KB 0.00 KB (0.00%)
cache.ts 12.16 KB 12.16 KB 0.00 KB (0.00%)
config.ts 23.89 KB 23.89 KB 0.00 KB (0.00%)
differ.ts 22.75 KB 22.75 KB 0.00 KB (0.00%)
http-client.ts 28.90 KB 28.90 KB 0.00 KB (0.00%)
http-router.ts 39.57 KB 39.57 KB 0.00 KB (0.00%)
logger.ts 12.34 KB 12.34 KB 0.00 KB (0.00%)
metric.ts 10.16 KB 10.16 KB 0.00 KB (0.00%)
optic.ts 7.14 KB 7.14 KB 0.00 KB (0.00%)
pubsub.ts 16.89 KB 16.89 KB 0.00 KB (0.00%)
queue.ts 13.71 KB 13.71 KB 0.00 KB (0.00%)
schedule.ts 12.46 KB 12.46 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 14.50 KB 14.50 KB 0.00 KB (0.00%)
schema-binary.ts 43.50 KB 43.50 KB 0.00 KB (0.00%)
schema-class.ts 22.50 KB 22.50 KB 0.00 KB (0.00%)
schema-codegen.ts 33.86 KB 33.86 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 30.95 KB 30.95 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 28.69 KB 28.69 KB 0.00 KB (0.00%)
schema-string-transformation.ts 16.26 KB 16.26 KB 0.00 KB (0.00%)
schema-string.ts 12.78 KB 12.78 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.86 KB 16.86 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 40.00 KB 40.00 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 21.64 KB 21.64 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 21.81 KB 21.81 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.90 KB 21.90 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.94 KB 26.94 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.96 KB 21.96 KB 0.00 KB (0.00%)
schema.ts 21.61 KB 21.61 KB 0.00 KB (0.00%)
stm.ts 14.96 KB 14.96 KB 0.00 KB (0.00%)
stream.ts 10.70 KB 10.70 KB 0.00 KB (0.00%)
supervisor.ts 12.13 KB 12.13 KB 0.00 KB (0.00%)

UI Bundle Size

Vite 8.4.0/Rolldown, production, default Oxc minification, es2023, ES modules, gzip level 9 per chunk. effect 4.2.0, Node v26.12.1. Effect-only client: 27408 B gzip (Δ 0 B vs base).

App Chunks Raw bytes Gzip bytes Added gzip B Δ raw bytes Δ gzip bytes
counter 1 175965 60767 33359 +46 +18
features 1 185617 64255 36847 +46 +22
menu 1 290412 98944 71536 +46 +15

This branch is waiting to be deployed

1 waiting deployment
fork — f0f718f4 Waiting Dec 3, 2026 by max-sixty via approval-gate #29427
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant